import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import path from 'path'; // 引入 path 模块
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [
        ElementPlusResolver()
      ],
    }),
    Components({
      resolvers: [
        ElementPlusResolver()
      ],
    })

  ],
  server: {
    port: 8080, // 设置运行端口为 8080
  },
  define: {
    'process.env': {
      'BASE_API': "http://smart.bookcase.wobituo.com",
      // 'BASE_API': "http://192.168.101.161:8003"

    }
  },
  resolve: {
    // 配置路径别名
    alias: {
      '@': path.resolve(__dirname, 'src'), // 
      '@components': path.resolve(__dirname, 'src/components'), // 
    },
  },
})
